.class public Lcom/netease/newsreader/view/HeadlineGallery;
.super Landroid/widget/FrameLayout;
.source "HeadlineGallery.java"

# interfaces
.implements Landroid/widget/AdapterView$OnItemSelectedListener;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/widget/FrameLayout;",
        "Landroid/widget/AdapterView$OnItemSelectedListener;"
    }
.end annotation


# static fields
.field private static final TAG:Ljava/lang/String; = "HeadlineGallery"


# instance fields
.field private mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

.field private mGallery:Lcom/netease/newsreader/view/MyGallery;

.field private mIndicator:Lcom/netease/newsreader/view/Indicator;


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 46
    invoke-direct {p0, p1}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;)V

    .line 47
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 42
    invoke-direct {p0, p1, p2}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 43
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 38
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/FrameLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 39
    return-void
.end method


# virtual methods
.method public getGallery()Landroid/widget/Gallery;
    .locals 1

    .prologue
    .line 60
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    return-object v0
.end method

.method protected onDetachedFromWindow()V
    .locals 3

    .prologue
    .line 121
    invoke-super {p0}, Landroid/widget/FrameLayout;->onDetachedFromWindow()V

    .line 122
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    if-eqz v0, :cond_0

    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    if-eqz v0, :cond_0

    .line 123
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    invoke-virtual {v0}, Lcom/netease/newsreader/adapter/HeadlineAdapter;->getCount()I

    move-result v0

    if-lez v0, :cond_0

    .line 124
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    iget-object v1, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    iget-object v2, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    invoke-virtual {v2}, Lcom/netease/newsreader/view/MyGallery;->getSelectedItemPosition()I

    move-result v2

    invoke-virtual {v1, v2}, Lcom/netease/newsreader/adapter/HeadlineAdapter;->getInitPosition(I)I

    move-result v1

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/view/MyGallery;->setSelection(I)V

    .line 127
    :cond_0
    return-void
.end method

.method protected onFinishInflate()V
    .locals 2

    .prologue
    .line 51
    invoke-super {p0}, Landroid/widget/FrameLayout;->onFinishInflate()V

    .line 52
    const v0, 0x7f0c00a3

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/HeadlineGallery;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/netease/newsreader/view/MyGallery;

    iput-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    .line 53
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    const/4 v1, 0x0

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/view/MyGallery;->setAutoRun(I)V

    .line 54
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    invoke-virtual {v0, p0}, Lcom/netease/newsreader/view/MyGallery;->setOnItemSelectedListener(Landroid/widget/AdapterView$OnItemSelectedListener;)V

    .line 56
    const v0, 0x7f0c00a6

    invoke-virtual {p0, v0}, Lcom/netease/newsreader/view/HeadlineGallery;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Lcom/netease/newsreader/view/Indicator;

    iput-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mIndicator:Lcom/netease/newsreader/view/Indicator;

    .line 57
    return-void
.end method

.method public onItemSelected(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 3
    .parameter
    .parameter "arg1"
    .parameter "position"
    .parameter "arg3"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/AdapterView",
            "<*>;",
            "Landroid/view/View;",
            "IJ)V"
        }
    .end annotation

    .prologue
    .line 77
    .local p1, adapter:Landroid/widget/AdapterView;,"Landroid/widget/AdapterView<*>;"
    iget-object v2, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    invoke-virtual {v2}, Lcom/netease/newsreader/adapter/HeadlineAdapter;->getRealCount()I

    move-result v0

    .line 78
    .local v0, count:I
    iget-object v2, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mIndicator:Lcom/netease/newsreader/view/Indicator;

    invoke-virtual {v2}, Lcom/netease/newsreader/view/Indicator;->getTotalItems()I

    move-result v2

    if-eq v2, v0, :cond_0

    .line 79
    iget-object v2, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mIndicator:Lcom/netease/newsreader/view/Indicator;

    invoke-virtual {v2, v0}, Lcom/netease/newsreader/view/Indicator;->setTotalItems(I)V

    .line 82
    :cond_0
    iget-object v2, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    invoke-virtual {v2, p3}, Lcom/netease/newsreader/adapter/HeadlineAdapter;->getRealPosition(I)I

    move-result v1

    .line 83
    .local v1, realPosition:I
    iget-object v2, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mIndicator:Lcom/netease/newsreader/view/Indicator;

    invoke-virtual {v2, v1}, Lcom/netease/newsreader/view/Indicator;->setCurrentItem(I)V

    .line 84
    return-void
.end method

.method public onNothingSelected(Landroid/widget/AdapterView;)V
    .locals 0
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/AdapterView",
            "<*>;)V"
        }
    .end annotation

    .prologue
    .line 88
    .local p1, arg0:Landroid/widget/AdapterView;,"Landroid/widget/AdapterView<*>;"
    return-void
.end method

.method protected onWindowVisibilityChanged(I)V
    .locals 3
    .parameter "visibility"

    .prologue
    .line 111
    invoke-super {p0, p1}, Landroid/widget/FrameLayout;->onWindowVisibilityChanged(I)V

    .line 112
    if-nez p1, :cond_0

    invoke-virtual {p0}, Lcom/netease/newsreader/view/HeadlineGallery;->isShown()Z

    move-result v0

    if-nez v0, :cond_1

    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    if-eqz v0, :cond_1

    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    if-eqz v0, :cond_1

    .line 113
    :cond_0
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    invoke-virtual {v0}, Lcom/netease/newsreader/adapter/HeadlineAdapter;->getCount()I

    move-result v0

    if-lez v0, :cond_1

    .line 114
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    iget-object v1, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    iget-object v2, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    invoke-virtual {v2}, Lcom/netease/newsreader/view/MyGallery;->getSelectedItemPosition()I

    move-result v2

    invoke-virtual {v1, v2}, Lcom/netease/newsreader/adapter/HeadlineAdapter;->getInitPosition(I)I

    move-result v1

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/view/MyGallery;->setSelection(I)V

    .line 117
    :cond_1
    return-void
.end method

.method public setAdapter(Lcom/netease/newsreader/adapter/HeadlineAdapter;)V
    .locals 3
    .parameter "adapter"

    .prologue
    .line 64
    iput-object p1, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    .line 65
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    invoke-virtual {v0, p1}, Lcom/netease/newsreader/view/MyGallery;->setAdapter(Landroid/widget/SpinnerAdapter;)V

    .line 66
    if-eqz p1, :cond_0

    .line 67
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    iget-object v1, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mAdapter:Lcom/netease/newsreader/adapter/HeadlineAdapter;

    const/4 v2, 0x0

    invoke-virtual {v1, v2}, Lcom/netease/newsreader/adapter/HeadlineAdapter;->getInitPosition(I)I

    move-result v1

    invoke-virtual {v0, v1}, Lcom/netease/newsreader/view/MyGallery;->setSelection(I)V

    .line 69
    :cond_0
    return-void
.end method

.method public setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V
    .locals 1
    .parameter

    .prologue
    .line 72
    .local p1, listener:Landroid/widget/AdapterView$OnItemClickListener;,"Landroid/widget/AdapterView$OnItemClickListener;"
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    invoke-virtual {v0, p1}, Lcom/netease/newsreader/view/MyGallery;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 73
    return-void
.end method

.method public startAutoScroll(Z)V
    .locals 1
    .parameter "autoScroll"

    .prologue
    .line 91
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    if-eqz v0, :cond_0

    .line 92
    iget-object v0, p0, Lcom/netease/newsreader/view/HeadlineGallery;->mGallery:Lcom/netease/newsreader/view/MyGallery;

    invoke-virtual {v0, p1}, Lcom/netease/newsreader/view/MyGallery;->startAutoScroll(Z)V

    .line 94
    :cond_0
    return-void
.end method
